package tcu.yuyp.pojo;


import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

@Data
//@JsonInclude(JsonInclude.Include.NON_NULL)//只返回json字符串中不为空的字符串-->也可一直接加到属性的上面
public class R {
    //用于封装servlet的响应数据

    private int code;//响应状态码
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String msg;//响应信息
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Object data;//响应数据

   /* //成功响应的格式
    public static <T> R<T> ok(T date){
        var instance = new R<T>();
        instance.setCode(200);
        instance.setData(date);
        return instance;
    }
    //失败响应的格式的方法
    public static <T> R<T> fail(int code, String msg){
        var instance = new R<T>();
        instance.setCode(code);
        instance.setMsg(msg);
        return instance;
    }*/

}
